--------------------------------------------------------------------------------
README for "Schools as Safety Nets: 
            Break-downs and Recovery in Reporting of Violence Against Children"
Pilar Larroulet & Damian Clarke & Daniel Pailañir & Daniela Quintana
Journal of Human Resources
2025
--------------------------------------------------------------------------------

This folder contains four sub-directories:
|_ data:    Contains all data used in the paper
|_ source:  Contains all source code used for replication of results
|_ results: Tables and figures provided in the paper
|_ log:     A log or equivalent file produced when running each source code

All results in the paper can be replicated by running the programs provided in
the "source" sub-directory, simply changing one global variable in each file po-
inting to the location of this folder on your computer.  Additionally, these fi-
les replicate the results contained in online appendices. A very small number of 
results (3 figures) from the online appendix are not included here given that 
they  are based on administrative records which we are not permitted to share as
part of public replication materials, but all results from the main body of the 
paper, and the vast majoryty of results from the online appendix are included. 
If you wish to generate the precise format of results from the paper, the tex fi-
le located in this directory can be compiled, providing the complete rendered ou-
tput.

All source files written in Stata are written for version >=16.0.  Source files 
written in R require versions of R from 3.6.3 or later.

Within the source folder there are three scripts which replicate all results in
the main paper (as well as related appendix results).  These are:

 (a) analysisCOVID.do: Replicates results examining COVID-19 related school clos-
     ures and re-openings.
 (b) analysisStrikes.do: Replicates results exmaning the impact of secondary sch-
     ool strikes
 (c) analysisVacations.do: Replicates results examining regular school analysis.

There are also three other scripts which replicate results which are only part of
online appendices.  These are:

 (d) analysisAuxiliary.do: Generates a number of auxiliary descriptive graphs.
 (e) analysisCounterfactual.do: Conducts counterfactual analysis from Appendix A3.
 (f) SchoolClosureMaps.R: Generates maps in Appendix Figures A8-A9.  

These can be run in Stata, using:
   do analysisXXXXXXXX.do
replace XXXXXXXX for the relevant file above
and in R using:
   source("SchoolClosureMaps.R")
after changing the MAIN global at the top of each script. This should be changed
to indicate the location of these replication materials on your computer. For exa-
mple, if the replication materials are located in a folder called "~/replication",
the line in each script defining the MAIN global should be set as:

    global MAIN "~/replication/"

No other changes are necessary.  The scripts can be run in any order.

A number of external user-written programs are required, which can be installed 
from the SSC in Stata, or CRAN in R.  In Stata do files, these are installed 
automatically if not available, provided that internet connectivity is available. 
If a required ado file is not installed and internet connectivity is not availab-
le, the script will fail to run until either the ado has been installed and the 
scripts are re-run, or internet connectivity is available and the script is re-
run.  In the case of SchoolClosureMaps.R, the required packages are indicated in 
the header of the script. To ensure backwards compatability, the precise versions 
of ado files are provided in the "compatatbility" subfolder of the source file.  
If desired, these can simply be placed in the main source directory ensuring that 
this code can be run if these files are updated in the future.

Tables are all exported as tex files, and figures are all exported as eps files
or in pdf format. If you desire to replicate the precise format of these tables
and figures as presented in the paper, you can compile the tex file in the main
directory using the following command:

  xelatex schools.tex

These scripts have all been tested on a notebook with 32GB of RAM, and an Intel
i7 with 8 cores using Stata MP version 18.0, and R version 4.4.2.  The files can
each be run in less than 10 minutes, and often substantially less than this, ap-
art from analysisCounterfactual.do, which takes approximately 45 minutes to run.


--------------------------------------------------------------------------------
For queries not covered in these replication materials contact Damian Clarke at:

  dclarke [AT] fen.uchile.cl

or

  damian.clarke [AT] protonmail.com.
